package cn.tedu.scc.mapper;

import cn.tedu.scc.entity.Product;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProductMapper {


    @Select("select * from product")
    @Result(property = "memberPrice",column = "member_price")
    @Result(property = "viewCount",column = "view_count")
    @Result(property = "saleCount",column = "sale_count")
    @Result(property = "categoryId",column = "category_id")
    List<Product> select();

    @Delete("delete from product where id=#{id}")
    void deleteById(int id);

    @Insert("insert into product values(null,#{title},#{url},#{price},0,0,0,#{created},#{categoryId},#{attribute})")
    void insert(Product product);
}
